using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.GamerServices;
using ScreenManagement;

namespace HexChess
{
    /// <summary>
    /// This is the main type for your game
    /// TODO:
    /// x_ Elevate top down
    /// x_ Allow players to rotate camera up
    /// x_ Allow rotate when AI thinking
    /// x_ Move howto screen down 10%, allow up scroll 10%
    /// billboard the files/ranks for the board
    /// x_ three alternate tile suggestions: available+dangerours(default), available, none [getavailablemoves(true), make a list of possible unique tiles, construct when LOCAL player ends turn in TWO player game]
    /// check playersigned in stuff
    /// </summary>
    public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        ScreenManager screenManager;

        // By preloading any assets used by UI rendering, we avoid framerate glitches
        // when they suddenly need to be loaded in the middle of a menu transition.
        static readonly string[] preloadAssets =
        {
            "Textures/ScreenManagement/mainbackground_light",
            "Textures/ScreenManagement/mainbackground_light_whole",
            "Textures/ScreenManagement/gradient",
            "Textures/ScreenManagement/splash",
            "Textures/xboxControllerStart"
        };

        public Game1()
        {
            Content.RootDirectory = "Content";

            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferWidth = 1280;
            graphics.PreferredBackBufferHeight = 720;
            graphics.SynchronizeWithVerticalRetrace = true;
            //graphics.IsFullScreen = true;
            //Guide.SimulateTrialMode = false;

#if XBOX
            GamerServicesComponent g = new GamerServicesComponent(this);
            Components.Add(g);
#endif

            // Create the screen manager component.
            screenManager = new ScreenManager(this);

            Components.Add(screenManager);

            // Activate the first screens.
            screenManager.AddScreen(new IntroScreen(), null);
            //screenManager.AddScreen(new GameplayScreen(null, HexChessBoard.GameVariant.Glinsky, 2, HexChessBoard.PieceColor.White, HexChessBoard.Difficulty.Easy, PlayerIndex.One), PlayerIndex.One);
        }

        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            foreach (string asset in preloadAssets)
            {
                Content.Load<object>(asset);
            }
        }

        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            graphics.GraphicsDevice.Clear(Color.Black);

            // The real drawing happens inside the screen manager component.
            base.Draw(gameTime);
        }
    }
}
